var music = document.getElementById('music');
var button = document.getElementById('musicButton');

function playPauseMusic() {
    if (music.paused) {
        music.play();
        button.style.animationPlayState = 'running';
    } 
    else {
        music.pause();
        button.style.animationPlayState = 'paused';
    }
}

button.addEventListener('click', playPauseMusic);

// Attempt to autoplay the music on page load.
// This may not work in all browsers due to autoplay policy restrictions.
music.play().catch(() => {});